import type { Column } from "@/components/CrudPage/type";
import StatusTag from "@/components/SRComponents/StatusTag/index.vue";

export function useSysPostProvider() {
  // 列配置
  const columns: Column[] = [
    {
      label: "职位名称",
      slot: "postName",
      prop: "postName",
      create: true,
      edit: true
    },
    {
      label: "是否为默认部门",
      slot: "isDefault",
      prop: "isDefault",
      create: true,
      edit: true,
      hide: true
    },
    {
      label: "状态",
      slot: "status",
      prop: "status",
      create: true,
      edit: true,
      cellRenderer: ({ row }) => <StatusTag status={row.status} />
    },
    {
      label: "排序",
      slot: "order",
      prop: "order",
      create: true,
      edit: true,
      cellRenderer: ({ row }) => <span>{row.order > 0 ? row.order : "-"}</span>
    },
    {
      label: "操作",
      prop: "operation",
      slot: "operation"
    }
  ];

  return {
    columns
  };
}
